﻿Public Class frmRegistrarImagenesEjercicio

    Public imagenInicial As String
    Public imagenFinal As String
    Dim imagenEnbyte1 As Byte()
    Dim imagenEnbyte2 As Byte()
    Dim myImg As Image
    Dim myImg2 As Image

    Private Sub btnAtras_Click(sender As Object, e As EventArgs) Handles btnAtras.Click
        Me.Hide()
        frmRegistrarEjercicio.Show()
    End Sub


    Private Sub subirImagenFinal_Click(sender As Object, e As EventArgs) Handles subirImagenFinal.Click
        cargarImagenFinal()

    End Sub

    Private Sub btnSubirImagenInicial_Click(sender As Object, e As EventArgs) Handles btnSubirImagenInicial.Click
        cargarImagenInicial()
     
    End Sub

    Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
        Me.Close()
        frmTransparente.Close()
        frmRegistrarEjercicio.Close()
        frmAsociarMusculosAEjercicio.Close()
    End Sub


    Private Sub cargarImagenInicial()
        Try
            Me.abrirArchivo.ShowDialog()
            If Me.abrirArchivo.FileName <> "" Then
                imagenInicial = abrirArchivo.FileName
                picBoxPosicionInicial.Load(imagenInicial)
                lblImagenInicialNoSubida.Visible = False
            Else

            End If
        Catch ex As Exception
        End Try

        myImg = picBoxPosicionInicial.Image 'Guardar la imagen del PictureBox en el objeto Image
        imagenEnbyte1 = ImagenToBytes(myImg)

    End Sub


    Private Sub cargarImagenFinal()
        Try
            Me.abrirArchivo2.ShowDialog()
            If Me.abrirArchivo2.FileName <> "" Then
                imagenFinal = abrirArchivo2.FileName
                picBoxPosicionFinal.Load(imagenFinal)
                lbImagenFinalNoSubida.Visible = False
            Else

            End If
        Catch ex As Exception

        End Try
        myImg2 = picBoxPosicionFinal.Image 'Guardar la imagen del PictureBox en el objeto Image
        imagenEnbyte2 = ImagenToBytes(myImg2)

    End Sub


    Private Sub btnSiguiente_Click(sender As Object, e As EventArgs) Handles btnSiguiente.Click
        frmAsociarMusculosAEjercicio.Show()
    End Sub
End Class